package com.zt.controller;

import com.zt.service.TransactionRecordService;
import com.zt.system.TransactionRecord;
import com.zt.system.vo.CardTableVO;
import com.zt.utils.Result;
import com.zt.vo.TransactionRecordVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("transactionRecord")
public class TransactionRecordController {

    @Resource
    private TransactionRecordService transactionRecordService;


    //查询所有交易记录
    @GetMapping("list")
    public Result list(TransactionRecordVo transactionRecordVo){
        return transactionRecordService.PageTransactionRecord(transactionRecordVo);
    }
    //    根据信用卡id查询本月的消费总计
    @GetMapping("transactionRecordByCardId")
    public List<TransactionRecord> transactionRecordByCardId(Integer cardId){
        return transactionRecordService.transactionRecordByCardId(cardId);
    }
    //    根据信用卡id查询本月的重置总计
    @GetMapping("transactionPayBackRecordByCardId")
    public List<TransactionRecord> transactionPayBackRecordByCardId(Integer cardId){
        return transactionRecordService.transactionPayBackRecordByCardId(cardId);
    }
    //    信用卡取现到银行卡
    @PostMapping("transactionRecordSave")
    public Result transactionRecordSave(CardTableVO cardTableVO){
        return transactionRecordService.transactionRecordSave(cardTableVO);
    }
    //    用银行卡还款信用卡月余额
    @PostMapping("transactionRecordPayBack")
    public Result transactionRecordPayBack(CardTableVO cardTableVO){
        return transactionRecordService.transactionRecordPayBack(cardTableVO);
    }
}
